#!/usr/bin/env python2
# ---------------------------------------------------------------------------
# single number as argument - find articles <= N days old
# otherwise use as a list of message ids
# argument for ecoding? per-line checksum?
# default - only feed in messages with correct msgid/has;
# alternate - feed lines passing checksum into queue/incoming

# ./qrpbbb_wrap.py 7
# ./qrpbbb_wrap.py plain 7
# ./qrpbbb_wrap.py linecheck 7
# ./qrpbbb_wrap.py linecheck 324237497 4u5435er3 435ueeruie

# destination runs "bash newarticles.sh", and like unshar regenerates
# articles, and then injects them

# payload's script is signed?


import os
import site_config as cfg
import qrpbbb_lib as lib

print "Messages in newsspool..."

for f in sorted (lib.newsspool_filelist()):
    all = lib.fetch_messagetext (f)
    msgid = lib.message_hash (all)
    print msgid, f

print "Messages in queuein..."

for f in lib.queuein_filelist():
    all = lib.fetch_messagetext (f)
    name = os.path.basename (f)
    msgid = lib.message_hash (all)
    print name, msgid, f

#
# ---------------------------------------------------------------------------
#
